<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>增加节点</title>
    <script type="text/javascript">
        function function1() {
            var temp = document.createElement("div");
            temp.innerHTML = "div的文字";
            temp.setAttribute("style","color:red;")
            document.getElementById("con").appendChild(temp);
        }
        function function2(){
            var temp = document.createElement("img");
            temp.setAttribute("src","./../asset/images/off.png")
            temp.setAttribute("width","100px;")
            document.getElementById("con").appendChild(temp);
        }
    </script>
</head>
<body>
<button onclick="function1()">添加文本</button>
<button onclick="function2()">添加图形</button>
<div id="con"></div>
</body>
</html>